package net.oschina.app.pages;

import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ListView;

import com.robotium.solo.By;
import com.robotium.solo.WebElement;

import net.oschina.app.SoloWrap;

/**
 * Created by Aaron on 2017/3/12.
 */

public class PageNewsDetail {
    private SoloWrap solo;
    WebView webView;

    public PageNewsDetail(SoloWrap solo){
        this.solo = solo;
    }

    public void initViews(){
        solo.sleep(8);
        FrameLayout fl = (FrameLayout) solo.getView("net.oschina.app:id/lay_webview");
        webView = (WebView)fl.getChildAt(0);
    }

    public WebView getWebView(){
        return webView;
    }

    public WebView getWebView2(){
        return (WebView)solo.getCurrentViews(WebView.class).get(0);
    }

    public String  getP1Content(){
        WebElement we =  solo.getWebElements(By.xpath("/html/body/div/h3[1]/strong")).get(0);
        we.getAttribute("class");
        return we.getText().toString();
    }
}
